package com.aaa.whj.service.impl;

import com.aaa.whj.dao.IPanDao;
import com.aaa.whj.entity.Plan;
import com.aaa.whj.service.IPlanService;
import com.mysql.jdbc.StringUtils;
import com.util.LayPage;
import com.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class PlanServiceImpl implements IPlanService {
    SqlSession session= SqlSessionFactoryUtil.getSession();
    IPanDao iPanDao=session.getMapper(IPanDao.class);

    @Override
    public List<Plan> queryAll(String page, String limit) {
        LayPage layPage = new LayPage();
        if(!StringUtils.isNullOrEmpty(page)){
            layPage.setPage(page);
        }
        if(!StringUtils.isNullOrEmpty(limit)){
            layPage.setLimit(Integer.parseInt(limit));

        }
        return this.iPanDao.queryAll(layPage);
    }

    @Override
    public long count(Plan plan) {
        return 0;
    }

    @Override
    public int deleteById(Integer plan_id) {
        return this.iPanDao.deleteById(plan_id);
    }

    @Override
    public int updateScl(Plan plan) {
        return this.iPanDao.updateScl(plan);
    }

    @Override
    public int addScl(Plan plan) {
        return this.iPanDao.addScl(plan);
    }

    @Override
    public List<Plan> query_scl(Plan plan) {
        return null;
    }


}
